package com.yya.ratelimiter.utils;

import com.yya.ratelimiter.service.TokenBucket;
import jdk.nashorn.internal.parser.Token;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Autor: yuanyongan
 * @Description:
 * @Date 2023/1/13 14:21
 */

@Component
public class ScheduleTask {
    @Resource
    TokenBucket tokenBucket;

    /**
     * 每秒给令牌桶更新
     */
//    @Scheduled(cron = "* * * * * ?")
    public void tokenIncr(){
        tokenBucket.tokenNumIncr();
    }
}
